// 放置全局指令
import { useUserStore } from '@/stores'
const adminPerms = '*:*:*'

export default {
  install(app) {
    app.directive('permission', {
      mounted(el, binding) {
        const perms = useUserStore().user.permissions
        // 判断是否是管理员
        if (perms.includes(adminPerms)) return
        if (!perms.includes(binding.value)) el.remove()
      }
    })
  }
}
